<?php

/**
 * HalalmenuMenu form base class.
 *
 * @method HalalmenuMenu getObject() Returns the current form's model object
 *
 * @package    halalmenu_dev
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseHalalmenuMenuForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'namemenu'        => new sfWidgetFormInputText(),
      'descriptionmenu' => new sfWidgetFormInputText(),
      'pricemenu'       => new sfWidgetFormInputText(),
      'order_number'    => new sfWidgetFormInputText(),
      'idrestaurant'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('HalalmenuRestaurant'), 'add_empty' => false)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'namemenu'        => new sfValidatorString(array('max_length' => 255)),
      'descriptionmenu' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'pricemenu'       => new sfValidatorNumber(array('required' => false)),
      'order_number'    => new sfValidatorInteger(),
      'idrestaurant'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('HalalmenuRestaurant'))),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('halalmenu_menu[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HalalmenuMenu';
  }

}
